<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Iterator Facade</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Fusion 2.2">
<link rel="up" href="../extension.html" title="Extension">
<link rel="prev" href="sequence_facade.html" title="Sequence Facade">
<link rel="next" href="../functional.html" title="Functional">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="sequence_facade.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../extension.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../functional.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="fusion.extension.iterator_facade"></a><a class="link" href="iterator_facade.html" title="Iterator Facade">Iterator Facade</a>
</h3></div></div></div>
<h5>
<a name="fusion.extension.iterator_facade.h0"></a>
        <span class="phrase"><a name="fusion.extension.iterator_facade.description"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.description">Description</a>
      </h5>
<p>
        The <a class="link" href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a>
        template provides an intrusive mechanism for producing a conforming Fusion
        iterator.
      </p>
<h5>
<a name="fusion.extension.iterator_facade.h1"></a>
        <span class="phrase"><a name="fusion.extension.iterator_facade.synopsis"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.synopsis">Synopsis</a>
      </h5>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Derived</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TravesalTag</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">iterator_facade</span><span class="special">;</span>
</pre>
<h5>
<a name="fusion.extension.iterator_facade.h2"></a>
        <span class="phrase"><a name="fusion.extension.iterator_facade.usage"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.usage">Usage</a>
      </h5>
<p>
        The user of iterator_facade derives his iterator type from a specialization
        of iterator_facade and passes the derived iterator type as the first template
        parameter. The second template parameter should be the traversal category
        of the iterator being implemented.
      </p>
<p>
        The user must implement the key expressions required by their iterator type.
      </p>
<div class="table">
<a name="fusion.extension.iterator_facade.t0"></a><p class="title"><b>Table 1.108. Parameters</b></p>
<div class="table-contents"><table class="table" summary="Parameters">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Description
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span></code>, <code class="computeroutput"><span class="identifier">It</span></code>, <code class="computeroutput"><span class="identifier">It1</span></code>,
                  <code class="computeroutput"><span class="identifier">It2</span></code>
                </p>
              </td>
<td>
                <p>
                  A type derived from <a class="link" href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">N</span></code>
                </p>
              </td>
<td>
                <p>
                  An <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
                  Integral Constant</a>
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<a name="fusion.extension.iterator_facade.t1"></a><p class="title"><b>Table 1.109. Key Expressions</b></p>
<div class="table-contents"><table class="table" summary="Key Expressions">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Expression
                </p>
              </th>
<th>
                <p>
                  Result
                </p>
              </th>
<th>
                <p>
                  Default
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_of</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The element stored at iterator position <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type returned when dereferencing an iterator of type <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  Dereferences iterator <code class="computeroutput"><span class="identifier">it</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">next</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type of the next element from <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">next</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  The next iterator after <code class="computeroutput"><span class="identifier">it</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">prior</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type of the next element from <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">prior</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  The next iterator after <code class="computeroutput"><span class="identifier">it</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">advance</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type of an iterator advanced <code class="computeroutput"><span class="identifier">N</span></code>
                  elements from <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  Implemented in terms of <code class="computeroutput"><span class="identifier">next</span></code>
                  and <code class="computeroutput"><span class="identifier">prior</span></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">advance</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">,</span> <span class="identifier">N</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  An iterator advanced <code class="computeroutput"><span class="identifier">N</span></code>
                  elements from <code class="computeroutput"><span class="identifier">it</span></code>
                </p>
              </td>
<td>
                <p>
                  Implemented in terms of <code class="computeroutput"><span class="identifier">next</span></code>
                  and <code class="computeroutput"><span class="identifier">prior</span></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">distance</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The distance between iterators of type <code class="computeroutput"><span class="identifier">It1</span></code>
                  and <code class="computeroutput"><span class="identifier">It2</span></code> as an
                  <a href="http://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
                  Integral Constant</a>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">distance</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it1</span><span class="special">,</span> <span class="identifier">it2</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  The distance between iterator <code class="computeroutput"><span class="identifier">it1</span></code>
                  and <code class="computeroutput"><span class="identifier">it2</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code> if <code class="computeroutput"><span class="identifier">It1</span></code>
                  is equal to <code class="computeroutput"><span class="identifier">It2</span></code>,
                  <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code> otherwise.
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">same_type</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span>
                  <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">equal_to</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span> <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it1</span><span class="special">,</span> <span class="identifier">it2</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns a type convertible to <code class="computeroutput"><span class="keyword">bool</span></code>
                  that evaluates to <code class="computeroutput"><span class="keyword">true</span></code>
                  if <code class="computeroutput"><span class="identifier">It1</span></code> is equal
                  to <code class="computeroutput"><span class="identifier">It2</span></code>, <code class="computeroutput"><span class="keyword">false</span></code> otherwise.
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">same_type</span><span class="special">&lt;</span><span class="identifier">It1</span><span class="special">,</span>
                  <span class="identifier">It2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">()</span></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">key_of</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The key type associated with the element from <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">value_of_data</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type of the data property associated with the element from
                  <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref_data</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
                </p>
              </td>
<td>
                <p>
                  The type that will be returned by dereferencing the data property
                  of the element from <code class="computeroutput"><span class="identifier">It</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">iterator</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">deref_data</span><span class="special">&lt;</span><span class="identifier">It</span><span class="special">&gt;::</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">it</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  Deferences the data property associated with the element referenced
                  by <code class="computeroutput"><span class="identifier">it</span></code>
                </p>
              </td>
<td>
                <p>
                  None
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h5>
<a name="fusion.extension.iterator_facade.h3"></a>
        <span class="phrase"><a name="fusion.extension.iterator_facade.header"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.header">Header</a>
      </h5>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">iterator</span><span class="special">/</span><span class="identifier">iterator_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">iterator_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<h5>
<a name="fusion.extension.iterator_facade.h4"></a>
        <span class="phrase"><a name="fusion.extension.iterator_facade.example"></a></span><a class="link" href="iterator_facade.html#fusion.extension.iterator_facade.example">Example</a>
      </h5>
<p>
        A full working example using <a class="link" href="iterator_facade.html" title="Iterator Facade"><code class="computeroutput"><span class="identifier">iterator_facade</span></code></a> is provided in triple.cpp
        in the extension examples.
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
      Dan Marsden, Tobias Schwinger<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="sequence_facade.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../extension.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../functional.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
